package com.neborosoft.FlyingDog.logic.search.navigation;

import com.neborosoft.FlyingDog.logic.database.content.identified.Audio;
import com.neborosoft.FlyingDog.logic.search.InternetSearchEngine;
import com.neborosoft.FlyingDog.logic.search.SearchResult;
import com.neborosoft.lib.threading.OnHostThreadExecutor;

import java.util.concurrent.Executor;

/**
 * Project: FlyingDog
 * User: stikhonenko
 * Date: 2/25/13
 * Time: 6:44 PM
 */
public class TagSongsNavigationList extends PageNavigationList<Audio> {
    public TagSongsNavigationList(InitParams<Audio> initialParams, Executor executor,
                                  OnHostThreadExecutor onHostThreadExecutor)
    {
        super(initialParams, executor, onHostThreadExecutor);
    }

    @Override
    protected SearchResult<Audio> search(int pageNumber) throws Exception{
        InternetSearchEngine internetSearchEngine = getInternetSearchEngine();
        String tag = getQuery();
        int elementsOfPageCount = getElementsOfPageCount();
        return internetSearchEngine.getSongsByTag(tag, elementsOfPageCount, pageNumber + 1);
    }
}
